<?php
include ('funct.php');
session_start();
$q=$_GET["firma"];
#$q = strtolower($q);
#if (!$q) return;
$sql="select sl_uslugi.id, sl_uslugi.nazwa from sl_uslugi, gab_bad where sl_uslugi.id_firmy = ".$q." and sl_uslugi.id = gab_bad.id_bad and gab_bad.id_gab = ".$_SESSION['wyb_gab']." and sl_uslugi.akt=1 order by sl_uslugi.nazwa, sl_uslugi.id_grupy";

#echo $sql;




$result=mysql_query($sql);

$ile=@mysql_numrows($result);
if ($ile>0) {
	while($row = mysql_fetch_array($result))
	{
		$items[]=array(optionValue=>$row[0], optionDisplay=>$row[1]);
	}
	#echo '<pre>';
	#print_r($items);
	
	}
	else $items[]=array(optionValue=>'0', optionDisplay=>'Brak badań');
	
if(function_exists(json_encode))
{
    echo json_encode($items); # this puts the php array in the funny javascript array/object 
                               # format so you don have to know how to translate manually
}
?>